package com.ykw.parking.mapper;

import com.ykw.parking.pojo1.Parking;
import com.ykw.parking.pojo1.ParkingLot;
import com.ykw.parking.pojo1.ParkingOne;
import com.ykw.parking.pojo1.UserOwner;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface OwnerMapper {
    @Select("select * from user_owner where uid=#{uid}")
    public UserOwner queryOwnerByUid(String uid);
    @Select("select * from parking_one where address=#{address}")
    public UserOwner queryOwnerByAddress(String address);

    @Insert("insert into user_owner value(#{uid},#{phone},#{city},#{address},#{state})")
    public int AddOwner(UserOwner userOwner);

    @Insert("insert into parking_one value(#{id},#{city},#{address},#{owner_phone},#{owner_name},0)")
    public int AddParking(ParkingOne parking);

    /*@Insert("insert into parking_lot(pid,identify,open,number,price,explain,sale) value(#{pid},#{identify},#{open},#{number},#{price},#{explain},#{sale})")*/
    public int AddParkingLot(ParkingLot parkingLot);
    @Select("select * from parking_one where address=#{address}")
    public Parking queryParkingOneByAddress(String address);

    @Select("select * from parking_lot where pid=#{pid} and number=#{number}")
    public ParkingLot queryParkingLotByPidByNum(String pid,String number);
    @Update("update parking_one set number=#{number} where id=#{id}")
    public int updatePakingNum(Integer number,Integer id);
}
